package top.yuanao.im.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.websocket.Session;

/**
 * 每一个webSocket请求都会被分装成一个IMUser对象,都是以对象的形式存入到list中的
 *
 * @user Yuanao
 * @CreateDate 2021/10/21 18:00
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class IMUser implements Comparable<IMUser> {
    private Session session;
    private String name;

    @Override
    public int compareTo(IMUser o) {
        return this.session.equals(o.session) ? 0 : this.name.compareTo(o.name);
    }
}
